import { Message, MessageBox } from 'element-ui';

let message = {
    message: function(str, type = 'success') {
        Message[type](str);
    },
    confirm: function(text, title = '提示', confirm = null, cancel = null) {
        MessageBox.confirm(text, title, {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        }).then((res) => {
            confirm && confirm(res);
        }).catch((res) => {
            cancel && cancel(res);
        });
    }
};

export default message;